import styles from './index.module.scss'

type Props = {
    onUpdate:(type:string, value:string) => void,
    hideList: () => void,
    type: '' | 'gender' | 'photo'
}
const genderList = [
  { title: '男', value: '0' },
  { title: '女', value: '1' }
]
const EditList = ({ hideList, type, onUpdate }:Props) => {
  return (
    <div className={styles.root}>
        { type === 'gender'
          ? genderList.map(item => <div key={item.value} className="list-item" onClick={() => onUpdate('gender', item.value)}>{item.title}</div>)
          : (<>
          <div className="list-item" onClick={() => onUpdate('photo', '')}>拍照</div>
          <div className="list-item" onClick={() => onUpdate('photo', '')}>上传</div></>) }

      <div className="list-item" onClick={hideList}>取消</div>
    </div>
  )
}

export default EditList
